# -*- encoding:utf-8 -*-
# !/usr/bin/env python
'''
    python-0823-03.py
    ======================
    @descript: 用继承的方法创建进程
    @copyright:nnz
    @author:dln
    @date: 2021/8/23 19:42
    @version:v1.0
'''




import multiprocessing
import os
from multiprocessing.process import BaseProcess

class A(multiprocessing.Process):
    def __init__(self,pum):
        BaseProcess.__init__(self)
        self.__num=pum
        pass
    pass
    def run(self):
        print('进程{}开始'.format(os.getpid(),os.getppid()))
        for element in range(1,self.__num+1):
            print('进程{}的值为：{}'.format(os.getpid(),element))
            pass
        print('进程{}结束'.format(os.getpid(),os.getppid()))
if __name__=='__main__':
    v_result=A(6)       #调用类，给传参
    v_result01=A(10)
    v_result.start()
    v_result01.start()